import config from "@renderer/config"
import http from "@renderer/utils/request"

export default {
  //系统监控
  monitor: {
    getData: {
      url: `${config.API_URL}/monitor/server`,
      name: "服务监控",
      get: async function () {
        return await http.get(this.url);
      }
    },
    tree: {
      url: `${config.API_URL}/system/unit/tree`,
      name: "获取机构树",
      get: async function (data) {
        return await http.get(this.url, data);
      }
    },
    addUnit: {
      url: `${config.API_URL}/system/unit/add`,
      name: "添加机构",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    delUnit: {
      url: `${config.API_URL}/system/unit/delete/`,
      name: "删除机构",
      get: async function (id) {
        return await http.get(`${this.url + id}`);
      }
    },
    updateUnit: {
      url: `${config.API_URL}/system/unit/update`,
      name: "更新机构",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    }
  },
  //缓存监控
  cache:{
    getData: {
      url: `${config.API_URL}/monitor/cache`,
      name: "服务监控",
      get: async function () {
        return await http.get(this.url);
      }
    },
  },
  //定时任务
  timing:{
    taskList: {
      url: `${config.API_URL}/task/job/page`,
      name: "定时任务列表",
      get: async function (data) {
        return await http.get(this.url,data);
      }
    },
    detail: {
      url: `${config.API_URL}/task/job/get/`,
      name: "定时任务详情",
      get: async function (id) {
        return await http.get(`${this.url+id}`);
      }
    },
    runOnce: {
      url: `${config.API_URL}/task/job/run/`,
      name: "立即执行任务（一次）",
      get: async function (id) {
        return await http.get(`${this.url+id}`);
      }
    },
    del: {
      url: `${config.API_URL}/task/job/delete`,
      name: "删除定时任务（批量）",
      post: async function (arr) {
        return await http.post(this.url,arr);
      }
    },
    addTask: {
      url: `${config.API_URL}/task/job/add`,
      name: "添加定时任务",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    },
    updateTask: {
      url: `${config.API_URL}/task/job/update`,
      name: "修改定时任务",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    },


  },
  // 调度日志
  logger:{
    list: {
      url: `${config.API_URL}/task/logger/page`,
      name: "调度日志列表",
      get: async function (data) {
        return await http.get(this.url,data);
      }
    },
    detail: {
      url: `${config.API_URL}/task/logger/get/`,
      name: "调度日志详情",
      get: async function (id) {
        return await http.get(`${this.url+id}`);
      }
    },
    clear: {
      url: `${config.API_URL}/task/logger/clean`,
      name: "清空日志",
      get: async function () {
        return await http.get(this.url);
      }
    },
  }
}
